﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Game_Admin_Demo.admin
{
    public partial class login : System.Web.UI.Page
    {
        DataClasses1DataContext dc = new DataClasses1DataContext();
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSubmit_ServerClick(object sender, EventArgs e)
        {
            string username = txtUserName.Value;
            string password = txtPassword.Value;

            var user = dc.taikhoans.SingleOrDefault(z=>z.username==username && z.password==password && z.quyen.ToLower()=="admin");
            if (user != null)
            {
                Session["username"] = user.username;
            }
            else {
                Label1.Text = "not ok";
            }
        }
    }
}